package constant;

/**
 * Created by chenkuo on 2017/8/3.
 */
public enum VehicleId {

    motuo("摩托车", 2),
    gongongjiaotong("公共交通",3),
    sqiche("汽车", 4),;


    private String vehicleName;
    private Integer vehicleCode;

    VehicleId(String vehicleName, Integer vehicleCode) {
        this.vehicleName = vehicleName;
        this.vehicleCode = vehicleCode;
    }


    public static Integer getVehicleCodeByName(String vehicleName) {
        VehicleId[] values = VehicleId.values();
        for (int i = 0; i < values.length; i++) {
            if (values[i].vehicleName.equals(vehicleName)) {
                return values[i].vehicleCode;
            }
        }
        return null;
    }
}
